package com.yitong.equipment.network.interceptor

import android.os.Build
import com.yitong.equipment.BuildConfig
import com.yitong.equipment.ext.getDeviceAgent
import okhttp3.Interceptor
import okhttp3.Response
import java.io.IOException

/**
 * 自定义头部参数拦截器，传入heads
 */
class AppHeadInterceptor : Interceptor {

    @Throws(IOException::class)
    override fun intercept(chain: Interceptor.Chain): Response {
        val builder = chain.request().newBuilder()
        builder.addHeader("source", "android").build()
        builder.addHeader("appId", "com.yitong.equipment").build()
        builder.addHeader("versionCode", BuildConfig.apiCode.toString()).build()
        builder.addHeader("versionName", BuildConfig.VERSION_NAME).build()
        builder.addHeader("phoneBrand", Build.BRAND).build()
        builder.addHeader("phoneModel", Build.MODEL).build()
        return chain.proceed(builder.build())
    }

}